#pragma once
#include "EngineHead.h"
#include "ResourceBase.h"

namespace mini
{
	struct ActorPlaceInfo
	{
		CVector point;
		CVector scale;
		CVector rotation;
	};
	class CActor;
	class CMaterialUnit;
	class CRenderNode : public CRefcount 
	{
		friend class CRenderer;
	public:
		CRenderNode();
		virtual ~CRenderNode();
		void bindActor(CActor* pActor, UINT32 rendererType);
		void setRenderer(UINT32 rendererType);
		UINT32 getRendererFlag() const;
		CActor* getActor() const;
		void pushPlaceInfo();
		void popPlaceInfo();
		void setRenderLayer(int nLayer);
		int  getRenderLayer();
		void effectLight(CActor* pActor);
		void unEffectLight(CActor* pActor);
		CRenderNode* Clone();
		void setMaterialUnit(CMaterialUnit* pMaterialUnit, int index = -1);
		const std::list<CMaterialUnit*>& getMaterialUnits() const;

	private:
		std::list<CMaterialUnit*> mMaterialUnits;
		CActor*	mpActor = nullptr;
		UINT32	mRendererFlag = 0;
		ActorPlaceInfo mPlaceInfo;
		int		mZbufferOffLayer = 0;
	};
}